<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>商品详情</title>
		<meta name="viewport" content="width=device-width,initial-scale=0.4,minimum-scale=0.45,maximum-scale=0.4,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<link href="../css/style.css?100" rel="stylesheet" />
		<script src="../js/jquery-1.9.1.min.js"></script>
		<script src="../js/flexible.js"></script>
		<script src="../js/flexible_css.js"></script>
		<script src="../js/mui.js"></script>
		<script src="../js/axios-proxy.js"></script>
		<script src="../conf.js"></script>
		<script src="../js/api.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
		<style>
			body{
      background-color: #fff;
    }
		.mui-bar-nav{
			height: 95px;
		}
		.mui-bar-nav a{
			width: 35px;
			height: 35px;
		}
		.mui-bar .mui-title{
			height: 95px;
			line-height: 95px;
			font-size: 40px;
		}
		.mui-bar .mui-icon{
			font-size: 60px;
			padding-top: 15px;
		}
  </style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" v-cloak>
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">商品详情</h1>
		</header>
		<div class="currency-box commodity-details-box" id="app">
			<div class="mui-slider mui-slider-commodity" id="slider">
				<div class="mui-slider-group">
					<div class="mui-slider-item" v-for="intet in mallbannerlist">
						<a href="#"><img :src="intet" /></a>
					</div>
				</div>
			</div>
			<!--商品信息头-->
			<div class="commodity-details-head">
				<ul class="commodity-details-head-ul">
					<li class="clearfix">
						<span class="commodity-details-afterprice">折后价</span>
						<span class="commodity-details-price">
							<font>￥</font>{{malldetailslist.zk_final_price}}
						</span>
						<span class="commodity-details-oldprice">原价<font>￥</font>{{malldetailslist.reserve_price}}</span>
					</li>
					<li class="clearfix commodity-details-title-box">
						<span class="commodity-details-title">{{malldetailslist.title}}</span>
						<span class="commodity-details-share">分享</span>
					</li>
					<li class="clearfix commodity-details-sold">已售{{malldetailslist.volume}}万</li>
					<li class="clearfix commodity-details-business">
						<img src="../images/icon_bankcard.png" alt="">
						<span class="commodity-details-business-title">{{malldetailslist.nick}}</span>
					</li>
				</ul>
			</div>
			<div class="commodity-details-dbox">
				<h6>商品详情</h6>
				<iframe :src="'http://hws.m.taobao.com/cache/wdesc/5.0/?id='+ malldetailslist.num_iid" width="100%" frameborder="0"></iframe>
			</div>
			<!--底部按钮-->
			<div class="commodity-details-btns clearfix" id="commodity-details-btns">
				<button class="commodity-details-btns-share">&nbsp;&nbsp;分享</button>
				<button @click="taobaoLian" class="commodity-details-btns-coupon">&nbsp;&nbsp;&nbsp;&nbsp;领券 <font>￥</font>{{mallJson.mallcoupon}}</button>
			</div>
		</div>
		<script type="text/javascript">
			function launchApp(val) {
				if (plus.os.name == "Android") {
					plus.runtime.launchApplication({
						pname: "com.taobao.taobao",
						extra: {
							url: val
						}
					}, function(e) {
						alert("打开失败:" + e.message);
					});
				} else if (plus.os.name == "iOS") {
					plus.runtime.launchApplication({
						action: "taobao://"
					}, function(e) {
						alert("打开失败: " + e.message);
					});
				}
			}

			function taobao(val) {
				var btnArray = ['否', '是'];
				mui.confirm('是否跳转到淘宝', '提示', btnArray, function(e) {
					if (e.index == 1) {
						//跳转淘宝
						//window.location.href = 'https://m.taobao.com/#index';
						//openNewPage('taobao.html')
						launchApp(val);


					} else {
						//取消跳转
						mui.toast('你取消了跳转淘宝');
					}
				})
			}
			let vm = new Vue({
				el: "#app",
				data: {
					malldetailslist: {},
					mallbannerlist: [],
					mallJson: JSON.parse(localStorage.getItem('mallJson')),
				},
				created: function() {
					mui.init({
						pullRefresh: autoRefresh('#app', this.getDetailsInfo)
					});
				},
				methods: {
					getDetailsInfo: function() {
						getcommodityinfo({
							num_iids: this.mallJson.mallId
						}, function(res) {
							var _data = res.results.n_tbk_item[0];
							vm.malldetailslist = _data;
							vm.mallbannerlist = _data.small_images.string;
							vm.$nextTick(function() {
								refreshContainer('#app');
								var slider = mui("#slider");
								slider.slider({
									interval: 1000
								});
							})
						})
					},
					taobaoLian: function() {
						plus.runtime.openURL(this.mallJson.mallURL, 'errorCB', "com.taobao.taobao");
					}
				}
			});
		</script>
	</body>

</html>
